function initCharts(data, num)
{    
    var num = num;
    var _data = data;
    var html = ''; 
    var cdm = (530 / num);
    var width = ((cdm - 5) * 100) / 530;
    var right = cdm / parseInt(6);
    $("#container-chart").html('').show('slow').css('border-bottom', '5px solid #369327');
    for(i=1;i<=num;i++)
    {
        var color = '';
        var borderheight = 0;//(data[(i-1)] * 150) / 100;
        var height_ = 120;//(150 - ((data[(i-1)] * 150) / 100)) + 20;
        if(borderheight >= 145)
        {
            //var color = 'color: #fff';
        }
        html = '<span style="width: '+width+'%;float: left;position:relative" id="id_'+i+'">\n\
                    <p class="border-'+i+' hoverMouse" data-id="'+i+'" style="margin: 0px '+right+'px;height: 150px;font-size: 20px;text-shadow: 0px 1px 0px #FFF;border: 0px #5bb75b solid;position: relative;bottom: 6px;box-sizing: border-box;'+color+'" id="chart-'+i+'">0 %</p><p style="font-size: 18px">'+i+'</p>\n\
                    <p id="rs-'+i+'" style="position: absolute; padding: 10px; border: 2px solid rgb(91, 183, 91); border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; box-shadow: rgb(204, 204, 204) 3px 3px 6px; width: 90px; display: none; left: 0px; bottom: 150px; right: 0px; margin: 0px auto; background: rgb(255, 255, 255);">'+data[(i-1)]+'</p>\n\
                </span>';
        $("#container-chart").append(html);
        $("#chart-"+i).animate({
          borderBottomWidth: borderheight+'px',
          paddingTop: height_+'px'
        }, 1000);        
    }    
    
}



function updateChart(data)
{    
    
    var lenght_ = data.length;
    console.log(data, lenght_);
    for(i=1;i<=lenght_;i++)
    {
        var pt = data[(i-1)];
        var color = '';
        var borderheight = (pt * 150) / 100;
        var calcPaddingTop = ((150 - ((pt * 150) / 100)) - 20);
        var height_ = calcPaddingTop < 0 ? 0 : calcPaddingTop;
        console.log(height_, pt);
        if(borderheight >= 145)
        {
           // var color = 'color: #fff';
        }
        if(pt != null || pt != '' || pt != undefined)
        {
            $("#chart-"+i).html(pt+' %').css('color', color);
            $("#chart-"+i).animate({
                borderBottomWidth: borderheight+'px',
                paddingTop: height_+'px'
            }, 100);    
        }       
    }              
}

function format_number(dec,fix) {
	fixValue = parseFloat(Math.pow(10,fix));
	retValue = parseInt(Math.round(dec * fixValue)) / fixValue;
	return retValue;
}